package com.zmm.zebulon.module.member.biz.mq.producer.user;

import com.zmm.zebulon.module.member.api.message.user.MemberUserCreateMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * description: 会员用户 Producer
 *
 * @author zebulon
 * package com.zmm.zebulon.module.member.biz.mq.producer.user
 * name: MemberUserProducer
 * date 2024/1/10 21:34
 */
@Slf4j
@Component
public class MemberUserProducer {

    @Resource
    private ApplicationContext applicationContext;

    /**
     * 发送 {@link MemberUserCreateMessage} 消息
     *
     * @param userId 用户编号
     */
    public void sendUserCreateMessage(Long userId) {
        applicationContext.publishEvent(new MemberUserCreateMessage().setUserId(userId));
    }

}

